package com.wuwei.elearning.question.service;

import com.wuwei.elearning.question.model.ChatMessage;
import com.wuwei.elearning.question.model.ChatRequest;
import com.wuwei.elearning.question.model.ChatResponse;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.List;

public interface AiService {
    
    /**
     * Send a message to AI provider and get a streaming response
     * @param request the chat request containing prompt and history
     * @return SSE emitter for streaming response
     */
    SseEmitter streamChatCompletion(ChatRequest request);
    

    /**
     * Get cached conversation for a user by userId
     * @param userId the user ID
     * @return list of chat messages or empty list if no cache exists
     */
    List<ChatMessage> getCachedConversation(String userId);
    
    /**
     * Save conversation to cache
     * @param userId the user ID
     * @param messages the conversation messages
     */
    void cacheConversation(String userId, List<ChatMessage> messages);
} 